from ronglian_sms_sdk import SmsSDK #导入短信

accId = '8aaf07087bc82708017bf7cf8ab00eac'
accToken = 'b9e57dc54f4c4879afa9609f68d2b58d'
appId = '8aaf07087bc82708017bf7cf8bb20eb3'
def send_message(mobile, code, time):
    import json
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return 1
    return 2

# redis链接
from django_redis import  get_redis_connection
def get_redis():
    conn = get_redis_connection()
    return conn